<div class="loans view">
<h2><?php  __('Loan');?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Person'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($loan['Person']['name'], array('controller' => 'people', 'action' => 'view', $loan['Person']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php //echo $this->Html->link($loan['User']['username'], array('controller' => 'users', 'action' => 'view', $loan['User']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $time->format($loan['Loan']['created']); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Estimated Devolution'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $time->format($loan['Loan']['estimated_devolution']); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Devolution Date'); ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $time->format($loan['Loan']['devolution_date']); ?>
			&nbsp;
		</dd>
	</dl>
	<div class="related">
		<h3><?php __('Related Copies');?></h3>
		<?php if (!empty($loan['Copy'])):?>
		<table cellpadding = "0" cellspacing = "0">
		<tr>
			<th><?php __('#'); ?></th>
			<th class="actions"><?php __('Actions');?></th>
		</tr>
		<?php
			$i = 0;
			foreach ($loan['Copy'] as $copy):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="altrow"';
				}
			?>
			<tr<?php echo $class;?>>
				<td><?php echo $copy['id'];?></td>
				<td class="actions">
					<?php echo $this->Html->link(__('View', true), array('controller' => 'copies', 'action' => 'view', $copy['id'])); ?>
				</td>
			</tr>
		<?php endforeach; ?>
		</table>
	<?php endif; ?>
	
		<div class="actions">
			<ul>
				<li><?php echo $this->Html->link(__('Return', true), array('controller' => 'loans', 'action' => 'return'));?> </li>
			</ul>
		</div>
	</div>
	<pre><?php print_r($copy)?></pre>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit Loan', true), array('action' => 'edit', $loan['Loan']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Delete Loan', true), array('action' => 'delete', $loan['Loan']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $loan['Loan']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('List Loans', true), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Loan', true), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List People', true), array('controller' => 'people', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Person', true), array('controller' => 'people', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Copies', true), array('controller' => 'copies', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Copy', true), array('controller' => 'copies', 'action' => 'add')); ?> </li>
	</ul>
</div>